package com.kolon.business.main.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kolon.business.app.dao.AppDao;
import com.kolon.business.main.dao.MainDao;
import com.kolon.framework.constant.Constant;
import com.kolon.framework.interfaces.SimpleController;

@Controller("com.kolon.business.main.controller.MainController")
public class MainController implements SimpleController {
	
	@Resource(name="MainDaoImpl")
	private MainDao mainDao;
	@Resource(name="AppDaoImpl")
	private AppDao appDao;
	
	@SuppressWarnings("rawtypes")
	@RequestMapping(value="/business/main/main.do")
	public ModelAndView controller(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		// 회원 세션 정보
		HttpSession httpSession = request.getSession();
		Map userMap = (Map)httpSession.getAttribute(Constant.SESSION_USER_INFO);
		// 리턴
		ModelAndView modelAndView = new ModelAndView();
		// 임시 IKENUC, 전자결제 설치여부 --------------------
		modelAndView.addObject("ikenucCnt", appDao.getTempUcUserMap(userMap));
		modelAndView.addObject("msignCnt", appDao.getTempSignUserMap(userMap));
		// ----------------------------------------------
		modelAndView.addObject("servList", mainDao.getList(null));

		return modelAndView;
	}

}
